import Vue from 'vue'
// import ElementUI from 'element-ui'
import App from './App.vue'
import router from './router/router'
import store from './store/store'
import axios from 'axios'
import echarts from 'echarts'
// import Mock from './mock/index'
// import 'element-ui/lib/theme-chalk/index.css'
import vueSwiper from 'vue-awesome-swiper'

import './assets/css/base.css'

// import 'assets/css/base.css'
Vue.config.devtools = true

// import './mock/index'
// Mock.init()
// 挂载总线
Vue.prototype.Bus = new Vue()
// 挂载axios
Vue.prototype.$axios = axios
// 挂载echarts
Vue.prototype.$echarts = echarts
// 权限判断部分
function permissionJudge (value) {
  // 此处获取vuex中储存的按钮菜单数据
  let list = store.state.userPermission
  for (let item of list) {
    if (item === value) {
      return true
    }
  }
  return false
}
Vue.directive('has', {
  inserted: function (el, binding) {
    if (!permissionJudge(binding.value)) {
      el.parentNode.removeChild(el)
    }
  }
})

// 使用elementui
// Vue.use(ElementUI)
Vue.config.productionTip = false
Vue.use(vueSwiper)

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
